<template>
  <view class="page-body">
    <order-item :li="info"></order-item>
    <slot></slot>
    <u-tabbar active-color="#1677ff" v-model="current" :list="list" @change="Switchchange">
    </u-tabbar>
  </view>
</template>

<script>
import orderItem from '@/components/order-item'
export default {
  components: { orderItem },
  name: 'comm_detail',
  data() {
    return {
      list: [
        {
          iconPath: 'home',
          selectedIconPath: 'home-fill',
          text: '资料',
          // count: 2,
          // isDot: true,
          pagePath: '/pages/my_customer/my_customer_client',
          customIcon: false
        },
        {
          iconPath: 'photo',
          pagePath: '/pages/my_customer/my_customer_visit',

          selectedIconPath: 'photo-fill',
          text: '拜访',
          customIcon: false
        },
        {
          iconPath: 'tags',
          pagePath: '/pages/my_customer/my_customer_data',

          selectedIconPath: 'tags-fill',
          text: '数据',
          customIcon: false
        },
        {
          iconPath: 'play-right',
          pagePath: '/pages/my_customer/my_customer_order',

          selectedIconPath: 'play-right-fill',
          text: '订单',
          customIcon: false
        },
        {
          iconPath: 'account',
          pagePath: '/pages/my_customer/my_customer_stock',

          selectedIconPath: 'account-fill',
          text: '库存',
          customIcon: false
        }
      ],
      loading: true
    }
  },
  props: {
    info: {
      type: Object,
      default: {}
    },
    current: {
      type: Number,
      default: 0
    },
    cid: {
      type: Number,
      default: 0
    }
  },
  methods: {
    Switchchange(e) {
      let path = this.list[e].pagePath + '?id=' + this.cid
      uni.redirectTo({
        url: path
      })
    },
    showAvatar() {
      this.$api.previewImgs([this.info.avatar], this.info.avatar)
    },
    cellPhone() {
      uni.makePhoneCall({
        phoneNumber: this.info.phone
      })
    },
    mapAddress() {
      uni.openLocation({
        //​使用微信内置地图查看位置。
        latitude: parseFloat(this.info.map[1]), //要去的纬度-地址
        longitude: parseFloat(this.info.map[0]), //要去的经度-地址
        name: this.info.map_address
      })
    }
  }
}
</script>

<style lang="scss">
page {
  background: #f8f9fc;
}
</style>
